﻿Imports System.IO

Partial Class WebUserControls_ImageShower
    Inherits System.Web.UI.UserControl

    Public Sub CaricaElencoImg()
        Dim di As DirectoryInfo = New DirectoryInfo(Server.MapPath("/"))
        Dim dirPath As String = di.FullName & "Homeimages"
        ' Path.Combine(Radice, Request.QueryString("Locale"), Request.QueryString("Album"))
        '  Throw New Exception(dirPath)
        Dim stringList As New List(Of String)
        If (Not System.IO.Directory.Exists(dirPath)) Then
            Exit Sub
        End If
        Dim ImagesFileName() As String = System.IO.Directory.GetFiles(Path.Combine(dirPath))
        For Each Str As String In ImagesFileName
            stringList.Add(Str.Replace(di.FullName, "").Replace("\", "/"))
        Next
        imgArray.Text = String.Join("|", stringList)
    End Sub

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            CaricaElencoImg()
        End If

    End Sub
End Class
